<template>
  <div class="rose-echart">
    <echart :option="option"></echart>
  </div>
</template>

<script setup lang="ts">
import { computed, defineProps, withDefaults } from "vue";
import Echart from "../index";
import { IPieChartDataType } from "../type/type";
interface Props {
  roseData: IPieChartDataType[];
  seriesName?: string;
}
const props = withDefaults(defineProps<Props>(), { seriesName: "分类数量" });
const option = computed(() => {
  return {
    tooltip: {
      trigger: "item"
    },
    toolbox: {
      show: true,
      feature: {
        mark: { show: true },
        dataView: { show: true, readOnly: false },
        restore: { show: true },
        saveAsImage: { show: true }
      }
    },
    series: [
      {
        name: props.seriesName,
        type: "pie",
        radius: [20, 150],
        center: ["50%", "50%"],
        roseType: "area",
        label: {
          show: false
        },
        itemStyle: {
          borderRadius: 8
        },
        data: props.roseData
      }
    ]
  };
});
</script>

<style scoped></style>
